

export function transform(array:Array<object>) {
    
    if(Array.isArray(array)){
        return array.reduce((files:any,file:any)=>{
            const key = file.id;
            files[key] = file;
            if(file.children && file.children.length){
               files = { ...files , ...transform(file.children) }  
            }
            return files
        },{})
    }
    return {}
}